In this article we will review how to customize the Tracker's templates in order to be able to quickly create HTML, XML, LibreCalc and LibreOffice files.
At the end of this article you will have the nice below additions in the "New" Desktop's menu :
Creating a new template is very easy.
On the Desktop, do a right click and select "New>Edit templates":
The window containing the builtin templates is displayed :
Let's create a simple HTML template.
In a Terminal type the below command :
cd /boot/home/config/settings/Tracker/Tracker\ New\ Templates
touch HTML\ file
This will create an empty file named "HTML file".
Right click on this new file and select "Get info":
As you can see this empty file doesn't contain any attribute:
Let's specify that this file is an HTML file :
addattr -t mime BEOS:TYPE text/html ./HTML\ file
listattr ./HTML\ file
Edit the file content with Pe editor :
Copy & paste the below content:
<!DOCTYPE html>
<html>
<header>
<title>Sample HTML</title>
</header>
<body>
<p>
Haiku is great!
</p>
</body>
</html>
Nice !
You have made your first template.
In order to create an XML template, we will apply the same methodology :
touch XML\ file
addattr -t mime BEOS:TYPE text/xml ./XML\ file
Then install Koder editor and edit the content of the XML file:
<?xml version="1.0" encoding="UTF-8"?>
<root>
<item>
</item>
<item>
</item>
</root>
Koder is a nice editor because you can shrink - if needed - some blocks of an XML file :
We will suppose that LibreOffice is installed on your system.
Open LibreCalc :
Save this empty document with "File> Save As":
Select the template folder and indicate "LibreCalc file" as the filename :
Confirm with "Save".
Then remove the ".ods" suffix in the filename.
The correct name is LibreOffice Writer, however I will use the shortcut "LibreOffice" to name the Writer application.
Open LibreOffice:
Select "File> Save As":
Indicate in the templates' folder, the filename "LibreOffice file":
Confirm with "Save".
Remove the ".odt" suffix in the filename:
As you can see, if you open the pop-up menu on the Desktop and select "New", all the new templates will be directly accessible:
You can then create with just one click:
The new created file will use the application which was used to open the original template file.
For instance for the new XML file, if you double click on it, the default editor will be Koder:
Do you use or create templates for your daily usage of Haiku?
You can put a comment below :)